import 'package:bottom_picker/bottom_picker.dart';
import 'package:bottom_picker/resources/arrays.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:home_box/pages/medicine/MedicineVM/medicine_add_vm.dart';

datePicker(BuildContext context, int type,MedicineVM vm) {
  BottomPicker.date(
    pickerTitle: Text(
      (type == 1) ? '选择生产日期' : "选择有效期止",
      style: TextStyle(
        fontWeight: FontWeight.bold,
        fontSize: 15,
        color: Colors.blue,
      ),
    ),
    dateOrder: DatePickerDateOrder.ymd,
    initialDateTime: DateTime(1996, 10, 22),
    maxDateTime: DateTime.now(),
    minDateTime: DateTime(1980),
    pickerTextStyle: TextStyle(
      color: Colors.blue,
      fontWeight: FontWeight.bold,
      fontSize: 12,
    ),
    onChange: (index) {},
    onSubmit: (index) {
      if (type == 1) {
        vm.updateProductDate(index);
      } else {
        vm.updateExpiryData(index);
      }
    },
    onDismiss: (p0) {},
    bottomPickerTheme: BottomPickerTheme.plumPlate,
  ).show(context);
}